<template>
  <div id="recruitTable">
    <el-dialog title="授权修改" :visible.sync="modifyVisible" :close-on-click-modal="false" width="700px" :close-on-press-escape="false">
      <el-form :model="modifyForm" ref="modifyForm" :inline="true" inline-message>
        <el-form-item prop="remark" :label="modifyForm.label">
          <template v-if="modifyForm.column==='inBeijing'">
            <el-select v-model="modifyForm.value" style="width:150px">
              <el-option :value="1" label="京内生源" />
              <el-option :value="2" label="京外生源" />
            </el-select>
          </template>
          <template v-else-if="modifyForm.column==='education'">
            <el-select v-model="modifyForm.value" style="width:150px">
              <el-option value="大专" label="大专" />
              <el-option value="本科生" label="本科生" />
              <el-option value="硕士研究生" label="硕士研究生" />
              <el-option value="博士研究生" label="博士研究生" />
              <el-option value="其他" label="其他" />
            </el-select>
          </template>
          <template v-else-if="modifyForm.column==='major'">
            <el-input v-model="modifyForm.value" style="width:600px" :maxlength="500" show-word-limit></el-input>
            <div>
              填写要求：专业可以填写专业大类、专业中类或具体专业名称，专业名称后括号中写对应的专业代码，多个专业之间用“;”隔开，最后一个专业后面不需要“;”。<br>
              示例：<b>法学(03);文学(05);管理学(12);信息与通信工程(0810);中国语言与文化(050108T);电子与计算机工程(080909T);网络空间安全(080911TK)</b>
            </div>
          </template>
          <el-input v-else v-model="modifyForm.value" style="width:600px"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click.native="modifySubmit" :loading="btnLoading">提交修改</el-button>
        <el-button @click.native="modifyVisible = false">取消</el-button>
      </div>
    </el-dialog>
    <el-dialog title="退回原因" :visible.sync="backFormVisible" :close-on-click-modal="false" width="700px" :close-on-press-escape="false">
      <el-form :model="backForm" ref="backForm" :inline="true" inline-message>
        <el-form-item prop="remark">
          <el-input v-model="backForm.remark" style="width:600px"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click.native="setState(5)" :loading="btnLoading">提交</el-button>
        <el-button @click.native="backFormVisible = false">取消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="dialogTitle" :visible.sync="addFormVisible" width="98%" top="20px" :close-on-click-modal="false" :close-on-press-escape="false">
      <el-form :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" inline-message :rules="editFormRules">
        <table cellspacing="0" cellpadding="0" class="mytable" v-if="this.editForm.theType===1">
          <tr>
            <th style="vertical-align: middle;">单位名称</th>
            <td style="vertical-align: middle;" :colspan="this.editForm.unitBeijing===1?1:3">
              <el-form-item prop="unitName">
                <el-input v-model="editForm.unitName" style="width:500px"></el-input>
              </el-form-item>
            </td>
            <th style="vertical-align: middle;" v-if="this.editForm.unitBeijing===1">生源类型</th>
            <td style="vertical-align: middle;" v-if="this.editForm.unitBeijing===1">
              <el-form-item prop="inBeijing">
                <el-select v-model="editForm.inBeijing" style="width:150px">
                  <el-option :value="1" label="京内生源" />
                  <el-option :value="2" label="京外生源" />
                </el-select>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle;">具体工作部门</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="department">
                <el-input v-model="editForm.department"></el-input>
              </el-form-item>
            </td>
            <th style="vertical-align: middle;">岗位</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="post">
                <el-input v-model="editForm.post"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle;">专业</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="major">
                <el-input v-model="editForm.major" style="width:500px" :maxlength="500" show-word-limit></el-input>
                <div>
                  填写要求：专业可以填写专业大类、专业中类或具体专业名称，专业名称后括号中写对应的专业代码，多个专业之间用“;”隔开，最后一个专业后面不需要“;”。<br>
                  示例：<b>法学(03);文学(05);管理学(12);信息与通信工程(0810);中国语言与文化(050108T);电子与计算机工程(080909T);网络空间安全(080911TK)</b>
                </div>
              </el-form-item>
            </td>
            <th style="vertical-align: middle;">学历要求</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="education">
                <el-select v-model="editForm.education" style="width:150px">
                  <el-option value="大专" label="大专" />
                  <el-option value="本科生" label="本科生" />
                  <el-option value="硕士研究生" label="硕士研究生" />
                  <el-option value="博士研究生" label="博士研究生" />
                  <el-option value="其他" label="其他" />
                </el-select>
              </el-form-item>
            </td>
          </tr>
        </table>
        <table cellspacing="0" cellpadding="0" class="mytable" v-else>
          <tr>
            <th style="vertical-align: middle;">单位名称</th>
            <td style="vertical-align: middle;" colspan="3">
              <el-form-item prop="unitName">
                <el-input v-model="editForm.unitName" style="width:500px"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle;">具体工作部门</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="department">
                <el-input v-model="editForm.department"></el-input>
              </el-form-item>
            </td>
            <th style="vertical-align: middle;">岗位</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="post">
                <el-input v-model="editForm.post"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle;">户籍要求</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="residenceRequirements">
                <el-input v-model="editForm.residenceRequirements"></el-input>
              </el-form-item>
            </td>
            <th style="vertical-align: middle;">学历学位</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="education">
                <el-input v-model="editForm.education"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle;">专业</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="major">
                <el-input v-model="editForm.major" style="width:500px" :maxlength="500" show-word-limit></el-input>
                <div>
                  填写要求：专业可以填写专业大类、专业中类或具体专业名称，专业名称后括号中写对应的专业代码，多个专业之间用“;”隔开，最后一个专业后面不需要“;”。<br>
                  示例：<b>法学(03);文学(05);管理学(12);信息与通信工程(0810);中国语言与文化(050108T);电子与计算机工程(080909T);网络空间安全(080911TK)</b>
                </div>
              </el-form-item>
            </td>
            <th style="vertical-align: middle;">其他条件</th>
            <td style="vertical-align: middle;">
              <el-form-item prop="others">
                <el-input v-model="editForm.others"></el-input>
              </el-form-item>
            </td>
          </tr>
          <tr>
            <th style="vertical-align: middle;">备注</th>
            <td style="vertical-align: middle;" colspan="3">
              <el-form-item prop="remark">
                <el-input v-model="editForm.remark" style="width:500px"></el-input>
              </el-form-item>
            </td>
          </tr>
        </table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click.native="editFormSubmit" :loading="editLoading">提交</el-button>
        <el-button @click.native="addFormVisible = false">取消</el-button>
      </div>
    </el-dialog>
    <!-- <el-dialog title="授权修改" :visible.sync="modifyVisible" width="98%" top="20px" :close-on-click-modal="false" :close-on-press-escape="false">
      {{canEditColumns}}
      {{canEditColumnsObj}}
      <table cellspacing="0" cellpadding="0" class="mytable" v-if="this.editForm.theType===1">
        <tr>
          <th style="vertical-align: middle;">单位名称</th>
          <td style="vertical-align: middle;" :colspan="this.editForm.unitBeijing===1?1:3">
            {{editForm.unitName}}
            <el-checkbox v-model="canEditColumnsObj.unitName"></el-checkbox>
          </td>
          <th style="vertical-align: middle;" v-if="this.editForm.unitBeijing===1">生源类型</th>
          <td style="vertical-align: middle;" v-if="this.editForm.unitBeijing===1">
            {{editForm.inBeijing===1?'京内生源':'京外生源'}}
            <el-checkbox v-model="canEditColumnsObj.inBeijing"></el-checkbox>
          </td>
        </tr>
        <tr>
          <th style="vertical-align: middle;">具体工作部门</th>
          <td style="vertical-align: middle;">
            {{editForm.department}}
            <el-checkbox v-model="canEditColumnsObj.department"></el-checkbox>
          </td>
          <th style="vertical-align: middle;">岗位</th>
          <td style="vertical-align: middle;">
            {{editForm.post}}
            <el-checkbox v-model="canEditColumnsObj.post"></el-checkbox>
          </td>
        </tr>
        <tr>
          <th style="vertical-align: middle;">专业</th>
          <td style="vertical-align: middle;">
            {{editForm.major}}
            <el-checkbox v-model="canEditColumnsObj.major"></el-checkbox>
          </td>
          <th style="vertical-align: middle;">学历要求</th>
          <td style="vertical-align: middle;">
            {{editForm.education}}
            <el-checkbox v-model="canEditColumnsObj.education"></el-checkbox>
          </td>
        </tr>
      </table>
      <table cellspacing="0" cellpadding="0" class="mytable" v-else>
        <tr>
          <th style="vertical-align: middle;">单位名称</th>
          <td style="vertical-align: middle;" colspan="3">
            {{editForm.unitName}}
            <el-checkbox v-model="canEditColumnsObj.unitName"></el-checkbox>
          </td>
        </tr>
        <tr>
          <th style="vertical-align: middle;">具体工作部门</th>
          <td style="vertical-align: middle;">
            {{editForm.department}}
            <el-checkbox v-model="canEditColumnsObj.department"></el-checkbox>
          </td>
          <th style="vertical-align: middle;">岗位</th>
          <td style="vertical-align: middle;">
            {{editForm.post}}
            <el-checkbox v-model="canEditColumnsObj.post"></el-checkbox>
          </td>
        </tr>
        <tr>
          <th style="vertical-align: middle;">户籍要求</th>
          <td style="vertical-align: middle;">
            {{editForm.residenceRequirements}}
            <el-checkbox v-model="canEditColumnsObj.residenceRequirements"></el-checkbox>
          </td>
          <th style="vertical-align: middle;">学历学位</th>
          <td style="vertical-align: middle;">
            {{editForm.education}}
            <el-checkbox v-model="canEditColumnsObj.education"></el-checkbox>
          </td>
        </tr>
        <tr>
          <th style="vertical-align: middle;">专业</th>
          <td style="vertical-align: middle;">
            {{editForm.major}}
            <el-checkbox v-model="canEditColumnsObj.major"></el-checkbox>
          </td>
          <th style="vertical-align: middle;">其他条件</th>
          <td style="vertical-align: middle;">
            {{editForm.others}}
            <el-checkbox v-model="canEditColumnsObj.others"></el-checkbox>
          </td>
        </tr>
        <tr>
          <th style="vertical-align: middle;">备注</th>
          <td style="vertical-align: middle;" colspan="3">
            {{editForm.remark}}
            <el-checkbox v-model="canEditColumnsObj.remark"></el-checkbox>
          </td>
        </tr>
      </table>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click.native="modifySubmit" :loading="editLoading">确定授权</el-button>
        <el-button @click.native="modifyVisible = false">取消</el-button>
      </div>
    </el-dialog> -->
    <template v-if="userType!==2||(state!==0&&state!==5)">
      <div v-if="state===5" style="margin-bottom:10px;font-weight:bolder">状态：已退回  退回原因：{{remarks?remarks:'无'}}</div>
      <template v-if="step==='bus_post_docking'">
        <el-button v-if="canBack&&!canModify" type="warning" style="color:#fff !important" @click="canModify=true">显示授权修改选项</el-button>
        <el-button v-if="canBack&&canModify" type="primary" @click="canModify=false">隐藏授权修改选项</el-button>
        <span v-if="canBack&&canModify"> 点击表格中保留岗位的数据后授权图标即可授权填报用户修改该数据</span>
        <template v-if="unitBeijing!==2">
          <el-button icon="el-icon-download" type="primary" style="float:right" @click="handleExport(1,1)">导出</el-button>
          <el-button v-if="canEdit" icon="el-icon-plus" type="success" style="float:right;margin-right:10px" @click="handleAdd(1)">新增</el-button>
          <el-button-group v-if="canEdit" style="float:left">
            <el-button type="primary" icon="el-icon-arrow-up" :loading="addLoading1" @click="moveData1(true)" :disabled="!moveUpFlag1">上移</el-button>
            <el-button type="primary" icon="el-icon-arrow-down" :loading="addLoading1" @click="moveData1(false)" :disabled="!moveDownFlag1">下移</el-button>
          </el-button-group>
          <h1 style="text-align:center">{{theYear}}年度应届毕业生招聘计划表（京内单位填写）</h1>
          <el-table :data="list1" highlight-current-row v-loading="listLoading1" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange1" ref="multipleTable1">
            <el-table-column type="selection" width="60" v-if="canEdit" key="edit1" />
            <el-table-column type="index" label="序号" width="60" align="center" key="index1">
            </el-table-column>
            <el-table-column prop="unitName" label="单位名称" min-width="150">
              <template slot-scope="scope">
                {{scope.row.unitName}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'unitName')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'unitName')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'unitName')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'unitName')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'unitName')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'unitName')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="inBeijing" label="生源类型" width="120" align="center">
              <template slot-scope="scope">
                {{scope.row.inBeijing===1?'京内生源':'京外生源'}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'inBeijing')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'inBeijing')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'inBeijing')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'inBeijing')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'inBeijing')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'inBeijing')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="department" label="具体工作部门" width="250">
              <template slot-scope="scope">
                {{scope.row.department}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'department')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'department')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'department')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'department')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'department')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'department')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="post" label="岗位" width="150">
              <template slot-scope="scope">
                {{scope.row.post}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'post')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'post')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'post')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'post')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'post')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'post')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="major" label="专业" width="250">
              <template slot-scope="scope">
                {{scope.row.major}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'major')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'major')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'major')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'major')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'major')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'major')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="education" label="学历要求" width="120" align="center">
              <template slot-scope="scope">
                {{scope.row.education}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'education')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'education')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'education')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'education')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'education')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'education')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="deduct" label="状态" width="80" align="center">
              <template slot-scope="scope">
                <span v-if="!scope.row.deduct">未操作</span>
                <span v-else-if="scope.row.deduct===1" style="color:red;font-weight:bolder">核减</span>
                <span v-else-if="scope.row.deduct===2" style="color:green;font-weight:bolder">保留</span>
              </template>
            </el-table-column>
            <el-table-column label="操作" width="400" key="edit" v-if="canEdit">
              <template slot-scope="scope">
                <el-button :loading="listLoading1" style="color:#fff !important" :disabled="scope.row.deduct===1" size="mini" type="warning" icon="el-icon-close" @click="setDeduct(scope.row.id,1)">核减</el-button>
                <el-button :loading="listLoading1" :disabled="scope.row.deduct===2" size="mini" type="success" icon="el-icon-check" @click="setDeduct(scope.row.id,2)">保留</el-button>
                <el-button size="mini" type="primary" @click="handleDetail(scope.row)">修改</el-button>
                <el-button :loading="listLoading1" size="mini" type="danger" @click="handleDel(scope.row.id)">删除</el-button>
              </template>
            </el-table-column>
            <!-- <el-table-column label="授权修改" width="100" key="edit" v-if="canBack">
              <template slot-scope="scope">
                <el-button v-if="scope.row.deduct===2&&scope.row.canEditColumns" size="mini" type="primary" @click="handleModify(scope.row)">查看</el-button>
                <el-button v-if="scope.row.deduct===2&&!scope.row.canEditColumns" size="mini" type="warning" style="color:#fff !important" @click="handleModify(scope.row)">授权</el-button>
              </template>
            </el-table-column> -->
          </el-table>
        </template>
        <template v-if="unitBeijing!==1">
          <el-button icon="el-icon-download" type="primary" style="float:right" @click="handleExport(1,2)">导出</el-button>
          <el-button v-if="canEdit" icon="el-icon-plus" type="success" style="float:right;margin-right:10px" @click="handleAdd(2)">新增</el-button>
          <el-button-group v-if="canEdit" style="float:left">
            <el-button type="primary" icon="el-icon-arrow-up" :loading="addLoading2" @click="moveData2(true)" :disabled="!moveUpFlag2">上移</el-button>
            <el-button type="primary" icon="el-icon-arrow-down" :loading="addLoading2" @click="moveData2(false)" :disabled="!moveDownFlag2">下移</el-button>
          </el-button-group>
          <h1 style="text-align:center">{{theYear}}年度应届毕业生招聘计划表（京外单位填写）</h1>
          <el-table :data="list2" highlight-current-row v-loading="listLoading2" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange2" ref="multipleTable2">
            <el-table-column type="selection" width="60" v-if="canEdit" key="edit2" />
            <el-table-column type="index" label="序号" width="60" align="center" key="index2">
            </el-table-column>
            <el-table-column prop="unitName" label="单位名称" min-width="150">
              <template slot-scope="scope">
                {{scope.row.unitName}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'unitName')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'unitName')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'unitName')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'unitName')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'unitName')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'unitName')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="department" label="具体工作部门" width="250">
              <template slot-scope="scope">
                {{scope.row.department}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'department')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'department')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'department')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'department')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'department')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'department')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="post" label="岗位" width="150">
              <template slot-scope="scope">
                {{scope.row.post}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'post')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'post')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'post')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'post')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'post')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'post')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="major" label="专业" width="250">
              <template slot-scope="scope">
                {{scope.row.major}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'major')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'major')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'major')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'major')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'major')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'major')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="education" label="学历要求" width="120" align="center">
              <template slot-scope="scope">
                {{scope.row.education}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'education')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'education')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'education')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'education')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'education')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'education')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="deduct" label="状态" width="80" align="center">
              <template slot-scope="scope">
                <span v-if="!scope.row.deduct">未操作</span>
                <span v-else-if="scope.row.deduct===1" style="color:red;font-weight:bolder">核减</span>
                <span v-else-if="scope.row.deduct===2" style="color:green;font-weight:bolder">保留</span>
              </template>
            </el-table-column>
            <el-table-column label="操作" width="400" key="edit" v-if="canEdit">
              <template slot-scope="scope">
                <el-button :loading="listLoading2" style="color:#fff !important" :disabled="scope.row.deduct===1" size="mini" type="warning" icon="el-icon-close" @click="setDeduct(scope.row.id,1)">核减</el-button>
                <el-button :loading="listLoading2" :disabled="scope.row.deduct===2" size="mini" type="success" icon="el-icon-check" @click="setDeduct(scope.row.id,2)">保留</el-button>
                <el-button size="mini" type="primary" @click="handleDetail(scope.row)">修改</el-button>
                <el-button :loading="listLoading2" size="mini" type="danger" @click="handleDel(scope.row.id)">删除</el-button>
              </template>
            </el-table-column>
            <!-- <el-table-column label="授权修改" width="100" key="edit" v-if="canBack">
              <template slot-scope="scope">
                <el-button v-if="scope.row.deduct===2&&scope.row.canEditColumns" size="mini" type="primary" @click="handleModify(scope.row)">查看</el-button>
                <el-button v-if="scope.row.deduct===2&&!scope.row.canEditColumns" size="mini" type="warning" style="color:#fff !important" @click="handleModify(scope.row)">授权</el-button>
              </template>
            </el-table-column> -->
          </el-table>
        </template>
        <template>
          <el-button icon="el-icon-download" type="primary" style="float:right" @click="handleExport(2)">导出</el-button>
          <el-button v-if="canEdit" icon="el-icon-plus" type="success" style="float:right;margin-right:10px" @click="handleAdd(3)">新增</el-button>
          <el-button-group v-if="canEdit" style="float:left">
            <el-button type="primary" icon="el-icon-arrow-up" :loading="addLoading3" @click="moveData3(true)" :disabled="!moveUpFlag3">上移</el-button>
            <el-button type="primary" icon="el-icon-arrow-down" :loading="addLoading3" @click="moveData3(false)" :disabled="!moveDownFlag3">下移</el-button>
          </el-button-group>
          <h1 style="text-align:center">{{theYear}}年度在职人员招聘计划表</h1>
          <el-table :data="list3" highlight-current-row v-loading="listLoading3" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange3" ref="multipleTable3">
            <el-table-column type="selection" width="60" v-if="canEdit" key="edit3" />
            <el-table-column type="index" label="序号" width="60" align="center" key="index3">
            </el-table-column>
            <el-table-column prop="unitName" label="单位名称" min-width="150">
              <template slot-scope="scope">
                {{scope.row.unitName}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'unitName')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'unitName')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'unitName')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'unitName')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'unitName')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'unitName')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="department" label="具体工作部门" width="250">
              <template slot-scope="scope">
                {{scope.row.department}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'department')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'department')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'department')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'department')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'department')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'department')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="post" label="岗位" width="150" align="center">
              <template slot-scope="scope">
                {{scope.row.post}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'post')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'post')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'post')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'post')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'post')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'post')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="residenceRequirements" label="户籍要求" width="100" align="center">
              <template slot-scope="scope">
                {{scope.row.residenceRequirements}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'residenceRequirements')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'residenceRequirements')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'residenceRequirements')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'residenceRequirements')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'residenceRequirements')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'residenceRequirements')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="education" label="学历学位" width="150" align="center">
              <template slot-scope="scope">
                {{scope.row.education}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'education')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'education')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'education')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'education')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'education')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'education')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="major" label="专业" width="150" align="center">
              <template slot-scope="scope">
                {{scope.row.major}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'major')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'major')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'major')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'major')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'major')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'major')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="others" label="其他条件" width="200" align="center">
              <template slot-scope="scope">
                {{scope.row.others}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'others')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'others')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'others')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'others')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'others')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'others')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="remark" label="备注" width="100">
              <template slot-scope="scope">
                {{scope.row.remark}}
                <template v-if="canBack&&canModify&&scope.row.deduct===2">
                  <el-tooltip v-if="inRoleModify(scope.row.canEditColumns,'remark')" :open-delay="600" class="item" effect="dark" content="取消授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-success" type="text" @click="handleModify(0,scope.row,'remark')"></el-button>
                  </el-tooltip>
                  <el-tooltip v-if="!inRoleModify(scope.row.canEditColumns,'remark')" :open-delay="600" class="item" effect="dark" content="授权修改该字段" placement="top">
                    <el-button :loading="btnLoading" icon="el-icon-circle-check" type="text" @click="handleModify(1,scope.row,'remark')"></el-button>
                  </el-tooltip>
                </template>
                <template v-if="!canEdit&&userType===1&&scope.row.deduct===2&&inRoleModify(scope.row.canEditColumns,'remark')">
                  <el-button :loading="btnLoading" icon="el-icon-edit" type="text" @click="modifyColumn(scope.row,'remark')"></el-button>
                </template>
              </template>
            </el-table-column>
            <el-table-column prop="deduct" label="状态" width="80" align="center">
              <template slot-scope="scope">
                <span v-if="!scope.row.deduct">未操作</span>
                <span v-else-if="scope.row.deduct===1" style="color:red;font-weight:bolder">核减</span>
                <span v-else-if="scope.row.deduct===2" style="color:green;font-weight:bolder">保留</span>
              </template>
            </el-table-column>
            <el-table-column label="操作" width="400" key="edit" v-if="canEdit">
              <template slot-scope="scope">
                <el-button :loading="listLoading3" style="color:#fff !important" :disabled="scope.row.deduct===1" size="mini" type="warning" icon="el-icon-close" @click="setDeduct(scope.row.id,1)">核减</el-button>
                <el-button :loading="listLoading3" :disabled="scope.row.deduct===2" size="mini" type="success" icon="el-icon-check" @click="setDeduct(scope.row.id,2)">保留</el-button>
                <el-button size="mini" type="primary" @click="handleDetail(scope.row)">修改</el-button>
                <el-button :loading="listLoading3" size="mini" type="danger" @click="handleDel(scope.row.id)">删除</el-button>
              </template>
            </el-table-column>
            <!-- <el-table-column label="授权修改" width="100" key="edit" v-if="canBack">
              <template slot-scope="scope">
                <el-button v-if="scope.row.deduct===2&&scope.row.canEditColumns" size="mini" type="primary" @click="handleModify(scope.row)">查看</el-button>
                <el-button v-if="scope.row.deduct===2&&!scope.row.canEditColumns" size="mini" type="warning" style="color:#fff !important" @click="handleModify(scope.row)">授权</el-button>
              </template>
            </el-table-column> -->
          </el-table>
        </template>
      </template>
      <template v-else>
        <h1 style="text-align:center">{{theYear}}年度招聘岗位</h1>
        <el-table :data="postList" highlight-current-row v-loading="listLoading4" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange">
          <el-table-column type="selection" width="55" v-if="canEdit">
          </el-table-column>
          <el-table-column type="index" label="序号" width="60" align="center">
          </el-table-column>
          <el-table-column prop="stepState" label="状态" width="80" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.stepState===0">未完成</span>
              <span v-else style="color:green;font-weight:bolder">已完成</span>
            </template>
          </el-table-column>
          <el-table-column prop="theType" label="岗位类型" width="150" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.theType===1">应届毕业生招聘</span>
              <span v-else>在职人员招聘</span>
            </template>
          </el-table-column>
          <el-table-column prop="unitName" label="单位名称" min-width="150" header-align="center">
            <template slot-scope="scope">
              {{scope.row.unitName}}（{{scope.row.unitBeijing===1?"在京单位":"京外单位"}}）
            </template>
          </el-table-column>
          <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.inBeijing===1">京内生源</span>
              <span v-if="scope.row.inBeijing===2">京外生源</span>
            </template>
          </el-table-column>
          <el-table-column prop="department" label="具体工作部门" width="250" header-align="center">
          </el-table-column>
          <el-table-column prop="post" label="岗位" width="150" header-align="center">
          </el-table-column>
          <el-table-column prop="major" label="专业" width="250" header-align="center">
          </el-table-column>
          <el-table-column prop="education" label="学历要求" width="120" align="center">
          </el-table-column>
        </el-table>
      </template>
      <div v-if="canEdit">
        <el-upload
          style="width:800px;margin-bottom:10px;"
          ref="upload"
          :action="this.$http.defaults.baseURL+this.$http.defaults.recruitAPI +'api/recruitGenFileInfo/upload'"
          :on-success="handleUploadSucc1"
          :on-error="uploadError"
          :before-upload="beforeUpload"
          accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-works,.wps"
          :show-file-list="false"
        >
          <el-button type="primary" :loading="saveloading">上传</el-button>
          <!-- <div slot="tip" class="el-upload__tip">注：支持上传word/pdf/wps文件</div>
          <div style="clear:both" /> -->
        </el-upload>
      </div>
      <div v-if="!fileListLoading">
        <template v-if="files&&files.length>0">
          <div v-for="(item,index) in files" :key="index" style="line-height:40px">
            <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
            <el-button v-if="canEdit" style="margin-left:10px" size="mini" type="danger" @click="beforeRemove(item,step,'files')">删除</el-button>
            <!-- <template v-if="item.fileType==='pdf'"><i style="cursor: pointer;" class="el-icon-search" @click="showfile(item.id)" /></template> -->
          </div>
        </template>
      </div>
      <div v-else>加载中...</div>
      <template>
        <el-button icon="el-icon-s-promotion" type="success" style="margin-bottom:20px" @click="setState(1)" v-if="canEdit" :loading='btnLoading'>提交</el-button>
        <el-button icon="el-icon-s-release" type="danger" style="margin-bottom:20px" v-if="canBack" @click="showBack()">退回</el-button>
      </template>
      <template v-if="step!=='bus_post_docking'">
        <h1 style="text-align:center">已提交批次</h1>
        <el-table :data="batchList" highlight-current-row v-loading="listLoading" style="width: 100%;margin-bottom: 20px;">
          <el-table-column prop="state" label="状态" width="150" align="center">
            <template slot-scope="scope">
              <el-tooltip v-if="scope.row.state===0" class="item" effect="dark" content="退回时间：2023年12月12日 退回原因：资料未盖章" placement="top" :open-delay="500">
                <el-tag effect="dark" type="danger" style="cursor: pointer;">已退回</el-tag>
              </el-tooltip>
              <el-tooltip v-else class="item" effect="dark" content="提交时间：2023年12月13日" placement="top" :open-delay="500">
                <el-tag effect="dark" type="success" style="cursor: pointer;">已提交</el-tag>
              </el-tooltip>
            </template>
          </el-table-column>
          <el-table-column prop="num" label="岗位数量" width="150" align="center">
            <template slot-scope="scope">
              <el-popover placement="right" trigger="hover" :open-delay="500">
                <div class="recruitTable">
                  <el-table :data="batchPostList" border>
                    <el-table-column prop="theType" label="岗位类型" width="150" align="center">
                    </el-table-column>
                    <el-table-column prop="unitName" label="单位名称" width="250" header-align="center">
                    </el-table-column>
                    <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
                      <template slot-scope="scope">
                        <span v-if="scope.row.inBeijing===1">京内生源</span>
                        <span v-if="scope.row.inBeijing===2">京外生源</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="department" label="具体工作部门" width="250" header-align="center">
                    </el-table-column>
                    <el-table-column prop="post" label="岗位" width="150" header-align="center">
                    </el-table-column>
                    <el-table-column prop="major" label="专业" width="250" header-align="center">
                    </el-table-column>
                    <el-table-column prop="education" label="学历要求" width="150" align="center">
                    </el-table-column>
                  </el-table>
                </div>
                <el-button slot="reference" type="text" icon="el-icon-search">{{scope.row.num}}</el-button>
              </el-popover>
            </template>
          </el-table-column>
          <el-table-column prop="files" label="附件" min-width="150">
            <template slot-scope="scope">
              <div v-if="!fileListLoading">
                <template v-if="files&&files.length>0">
                  <div v-for="(item,index) in files" :key="index" style="line-height:40px">
                    <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
                  </div>
                </template>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </template>
    <template v-else>
      <div v-if="state===5" style="margin-bottom:10px;font-weight:bolder">状态：已退回  退回原因：{{remarks?remarks:'无'}}</div>
      <div v-else style="padding:20px; font-size:14px;color:#999;text-align:center">暂无数据</div>
    </template>
  </div>
</template>
<script>
import qs from 'qs'
export default {
  props: {
    step: '',
    timestamp: '',
    userType: null,
    unitId: null,
    type: null,
    theYear: null,
    unitBeijing: null,
    canAudit: null
  },
  watch: {
    step (val) {
      console.log(val)
    },
    userType (val) {
      console.log(val)
    },
    timestamp (val) {
      this.getFileList()
      this.getStepBatch()
    },
    type (val) {
      console.log(val)
    },
    unitId (val) {
      console.log(val)
    },
    theYear (val) {
      console.log(val)
    },
    unitBeijing (val) {
      console.log(val)
    },
    batchState (val) {
      console.log(val)
    },
    canAudit (val) {
      console.log(val)
    }
  },
  data () {
    return {
      modifyForm: {
        id: null,
        label: '',
        column: '',
        value: ''
      },
      canModify: false,
      modifyVisible: false,
      canEditColumnsObj: {
        unitName: false,
        inBeijing: false,
        department: false,
        post: false,
        residenceRequirements: false,
        education: false,
        major: false,
        others: false,
        remark: false
      },
      canEditColumns: [],
      moveUpFlag1: false,
      moveDownFlag1: false,
      multipleSelection1: [],
      moveUpFlag2: false,
      moveDownFlag2: false,
      multipleSelection2: [],
      moveUpFlag3: false,
      moveDownFlag3: false,
      multipleSelection3: [],
      addLoading1: false,
      addLoading2: false,
      addLoading3: false,
      remarks: null,
      listLoading1: false,
      listLoading2: false,
      listLoading3: false,
      listLoading4: false,
      state: null,
      canEdit: false,
      canBack: false,
      dialogEdit: 0,
      batchList: [
        {unitName: '111', beijing: '京内', num: 2, state: 0},
        {unitName: '111', beijing: '京内', num: 2, state: 1}
      ],
      batchPostList: [
        {unitName: '111(京内)', theType: '应届毕业生招聘', beijing: '京内', department: '财务处', post: '出纳', major: '会计学', education: '本科生', state: 1},
        {unitName: '111(京内)', theType: '在职招聘', beijing: '京外', department: '办公室', post: '文员', major: '汉语言', education: '硕士研究生', state: 0}
      ],
      postList: [
        // {unitName: '111(京内)', theTypeId: 1, theType: '应届毕业生招聘', beijing: '京内', education: '大专', state: 0, department: '财务处', post: '出纳', major: '会计学', times: 0},
        // {unitName: '111(京内)', theTypeId: 1, theType: '应届毕业生招聘', beijing: '京内', education: '本科生', state: 1, department: '财务处', post: '出纳', major: '会计学', realName: '张三', idCardNo: '131002198801021234', times: 1},
        // {unitName: '111(京内)', theTypeId: 1, theType: '应届毕业生招聘', beijing: '京内', education: '本科生', state: 2, department: '办公室', post: '文员', major: '汉语言', realName: '测试', idCardNo: '132801198201034231', times: 2},
        // {unitName: '111(京内)', theTypeId: 2, theType: '在职招聘', beijing: '京外', department: '信息中心', post: '科员', major: '计算机', education: '硕士研究生', state: 0, realName: '111', idCardNo: '133012198811124123', times: 1},
        // {unitName: '111(京内)', theTypeId: 2, theType: '在职招聘', beijing: '京外', education: '其他', state: 0, department: '办公室', post: '文员', major: '汉语言', times: 0}
      ],
      list1: [
      ],
      list2: [
      ],
      list3: [
      ],
      dialogTitle: '',
      // 专业类别未补全、民族未补全
      typeList: [{label: '应届毕业生招聘', value: 2}, {label: '在职人员招聘', value: 1}],
      sexList: [{label: '男', value: 1}, {label: '女', value: 0}],
      nationList: [
        '汉族',
        '蒙古族',
        '回族',
        '藏族',
        '维吾尔族',
        '苗族',
        '彝族',
        '壮族',
        '布依族',
        '朝鲜族',
        '满族',
        '侗族',
        '瑶族',
        '白族',
        '土家族',
        '哈尼族',
        '哈萨克族',
        '傣族',
        '黎族',
        '傈僳族',
        '佤族',
        '畲族',
        '高山族',
        '拉祜族',
        '水族',
        '东乡族',
        '纳西族',
        '景颇族',
        '柯尔克孜族',
        '土族',
        '达斡尔族',
        '仫佬族',
        '羌族',
        '布朗族',
        '撒拉族',
        '毛南族',
        '仡佬族',
        '锡伯族',
        '阿昌族',
        '普米族',
        '塔吉克族',
        '怒族',
        '乌孜别克族',
        '俄罗斯族',
        '鄂温克族',
        '德昂族',
        '保安族',
        '裕固族',
        '京族',
        '塔塔尔族',
        '独龙族',
        '鄂伦春族',
        '赫哲族',
        '门巴族',
        '珞巴族',
        '基诺族'
      ],
      maritalStatusList: ['未婚', '已婚', '离婚', '丧偶'],
      degreeList: ['博士', '硕士', '学士', '其他'],
      educationList: ['大专', '本科生', '硕士研究生', '博士研究生', '其他'],
      recruitmentMethodList: [{label: '考试', value: 1}, {label: '引进', value: 2}],
      editLoading: false,
      backForm: {remark: ''},
      backFormVisible: false,
      fileListLoading: false,
      btnLoading: false,
      saveloading: false,
      files: [],
      listLoading: false,
      addFormVisible: false,
      addFormVisible_2: false,
      addFormVisible2: false,
      list: [],
      list_2: [],
      editFormRules: {
        unitName: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inBeijing: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        department: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        post: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        major: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        education: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        residenceRequirements: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        others: [
          { required: true, message: '必填', trigger: 'blur' }
        ]
      },
      editForm: {
        id: null,
        deduct: '',
        unitBeijing: '',
        unitName: '',
        inBeijing: '',
        post: '',
        department: '',
        major: '',
        education: '',
        residenceRequirements: '',
        others: '',
        theType: null,
        remark: ''
      },
      multipleSelection: []
    }
  },
  methods: {
    modifyColumn (obj, column) {
      this.modifyVisible = true
      this.modifyForm.id = obj.id
      this.modifyForm.column = column
      let dicObj = {
        unitName: '单位名称',
        inBeijing: '生源类型',
        department: '具体工作部门',
        education: '学历要求',
        residenceRequirements: '户籍要求',
        post: '岗位',
        major: '专业',
        others: '其他条件',
        remark: '备注'
      }
      this.modifyForm.label = dicObj[column]
      this.modifyForm.value = obj[column]
    },
    inRoleModify (canEditColumns, column) {
      if (canEditColumns) {
        return canEditColumns.split(',').includes(column)
      } else {
        return false
      }
    },
    handleModify (flag, obj, column) {
      this.$confirm('确认' + (flag ? '' : '取消') + '授权修改该字段吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let arr = (obj.canEditColumns ? obj.canEditColumns.split(',') : [])
        if (flag) {
          arr.push(column)
          arr = [...new Set(arr)]
        } else {
          arr = arr.filter(item => item !== column)
        }
        let para = {
          'id': obj.id,
          'canEditColumns': arr.join(',')
        }
        this.btnLoading = true
        this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/save`, para).then(response => {
          this.btnLoading = false
          if (response.data.success === true) {
            this.$message({
              message: '操作成功',
              type: 'success'
            })
            this.getPostList()
          } else {
            console.log('操作失败:' + response.data.message)
            this.$message({
              message: '操作失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          this.btnLoading = false
          console.log(error)
          this.$message({
            message: '操作失败:' + error,
            type: 'error'
          })
        })
      })
      // this.editForm.id = obj.id
      // this.editForm.deduct = obj.deduct
      // this.editForm.unitBeijing = obj.unitBeijing
      // this.editForm.theType = obj.theType
      // this.editForm.unitName = obj.unitName
      // this.editForm.inBeijing = obj.inBeijing
      // this.editForm.department = obj.department
      // this.editForm.post = obj.post
      // this.editForm.major = obj.major
      // this.editForm.education = obj.education
      // this.editForm.residenceRequirements = obj.residenceRequirements
      // this.editForm.remark = obj.remark
      // this.editForm.others = obj.others
      // this.canEditColumns = obj.canEditColumns ? obj.canEditColumns.split(',') : []
      // this.canEditColumnsObj = {
      //   unitName: false,
      //   inBeijing: false,
      //   department: false,
      //   post: false,
      //   residenceRequirements: false,
      //   education: false,
      //   major: false,
      //   others: false,
      //   remark: false
      // }
      // this.canEditColumns.forEach(element => {
      //   this.canEditColumnsObj[element] = true
      // })
      // this.modifyVisible = true
    },
    modifySubmit () {
      if (this.modifyForm.column === 'major') {
        let reg = /^[\u4e00-\u9fa5]+\([\da-zA-Z]+\)(;[\u4e00-\u9fa5]+\([\da-zA-Z]+\))*$/g
        this.modifyForm.value = this.modifyForm.value.toString().replace(/（/g, '(').replace(/）/g, ')').replace(/；/g, ';')
        if (!reg.test(this.modifyForm.value) || this.modifyForm.value.includes('00)')) {
          this.$message({
            message: '专业格式填写错误，请参照示例填写',
            type: 'error'
          })
          return false
        }
      }
      let para = {
        'id': this.modifyForm.id,
        'column': this.modifyForm.column,
        'value': this.modifyForm.value
      }
      this.btnLoading = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/updateColumn`, para).then(response => {
        this.btnLoading = false
        if (response.data.success === true) {
          this.$message({
            message: '提交修改成功',
            type: 'success'
          })
          this.modifyVisible = false
          this.getPostList()
        } else {
          console.log('提交修改失败:' + response.data.message)
          this.$message({
            message: '提交修改失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        this.btnLoading = false
        console.log(error)
        this.$message({
          message: '操作失败:' + error,
          type: 'error'
        })
      })
    },
    handleSelectionChange1 (val) {
      this.moveUpFlag1 = false
      this.moveDownFlag1 = false
      this.multipleSelection1 = val
      if (this.multipleSelection1.length === 1) {
        this.moveUpFlag1 = true
        this.moveDownFlag1 = true
        if (this.list1.findIndex(item => item.id === this.multipleSelection1[0].id) === 0) {
          this.moveUpFlag1 = false
        }
        if (this.list1.findIndex(item => item.id === this.multipleSelection1[0].id) === this.list1.length - 1) {
          this.moveDownFlag1 = false
        }
      }
    },
    handleSelectionChange2 (val) {
      this.moveUpFlag2 = false
      this.moveDownFlag2 = false
      this.multipleSelection2 = val
      if (this.multipleSelection2.length === 1) {
        this.moveUpFlag2 = true
        this.moveDownFlag2 = true
        if (this.list2.findIndex(item => item.id === this.multipleSelection2[0].id) === 0) {
          this.moveUpFlag2 = false
        }
        if (this.list2.findIndex(item => item.id === this.multipleSelection2[0].id) === this.list2.length - 1) {
          this.moveDownFlag2 = false
        }
      }
    },
    handleSelectionChange3 (val) {
      this.moveUpFlag3 = false
      this.moveDownFlag3 = false
      this.multipleSelection3 = val
      if (this.multipleSelection3.length === 1) {
        this.moveUpFlag3 = true
        this.moveDownFlag3 = true
        if (this.list3.findIndex(item => item.id === this.multipleSelection3[0].id) === 0) {
          this.moveUpFlag3 = false
        }
        if (this.list3.findIndex(item => item.id === this.multipleSelection3[0].id) === this.list3.length - 1) {
          this.moveDownFlag3 = false
        }
      }
    },
    moveData1 (flag) {
      let para = {
        id: this.multipleSelection1[0].id,
        up: flag
      }
      this.addLoading1 = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/updateOrder`, para).then(response => {
        console.log(response.data.success)
        if (response.data.success === true) {
          this.addLoading1 = false
          this.getPostList('list1', this.multipleSelection1[0].id)
        } else {
          console.log('调整顺序失败:' + response.data.message)
          this.$message({
            message: '调整顺序失败:' + response.data.message,
            type: 'error'
          })
          this.addLoading1 = false
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '调整顺序失败:' + error,
          type: 'error'
        })
        this.addLoading1 = false
      })
    },
    moveData2 (flag) {
      let para = {
        id: this.multipleSelection2[0].id,
        up: flag
      }
      this.addLoading2 = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/updateOrder`, para).then(response => {
        console.log(response.data.success)
        if (response.data.success === true) {
          this.addLoading2 = false
          this.getPostList('list2', this.multipleSelection2[0].id)
        } else {
          console.log('调整顺序失败:' + response.data.message)
          this.$message({
            message: '调整顺序失败:' + response.data.message,
            type: 'error'
          })
          this.addLoading2 = false
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '调整顺序失败:' + error,
          type: 'error'
        })
        this.addLoading2 = false
      })
    },
    moveData3 (flag) {
      let para = {
        id: this.multipleSelection3[0].id,
        up: flag
      }
      this.addLoading3 = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/updateOrder`, para).then(response => {
        console.log(response.data.success)
        if (response.data.success === true) {
          this.addLoading3 = false
          this.getPostList('list3', this.multipleSelection3[0].id)
        } else {
          console.log('调整顺序失败:' + response.data.message)
          this.$message({
            message: '调整顺序失败:' + response.data.message,
            type: 'error'
          })
          this.addLoading3 = false
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '调整顺序失败:' + error,
          type: 'error'
        })
        this.addLoading3 = false
      })
    },
    handleExport (theType, unitBeijing) {
      let para = {
        theYear: this.theYear,
        unitBeijing: unitBeijing,
        theType: theType,
        unitId: this.unitId
      }
      window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusPost/getExport?' + qs.stringify(para))
    },
    handleSelectionChange (val) {
      this.multipleSelection = val
    },
    setDeduct (id, state) {
      let para = {
        'id': id,
        'deduct': state
      }
      this.listLoading1 = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/save`, para).then(response => {
        this.listLoading1 = false
        if (response.data.success === true) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.getPostList()
        } else {
          console.log('操作失败:' + response.data.message)
          this.$message({
            message: '操作失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        this.listLoading1 = false
        console.log(error)
        this.$message({
          message: '操作失败:' + error,
          type: 'error'
        })
      })
    },
    toggleSelection (objName, id) {
      let multipleTable = 'multipleTable1'
      if (objName === 'list1') {
        multipleTable = 'multipleTable1'
      } else if (objName === 'list2') {
        multipleTable = 'multipleTable2'
      } else {
        multipleTable = 'multipleTable3'
      }
      this.$nextTick(() => {
        if (id) {
          let newrow = this[objName].find(item => item.id === id)
          console.log(newrow)
          this.$refs[multipleTable].toggleRowSelection(newrow)
        } else {
          this.$refs[multipleTable].clearSelection()
        }
      })
    },
    getPostList (objName, selectedId) {
      let para = {}
      if (!objName || objName === 'list1') {
        para = {
          'step': this.step,
          'theYear': this.theYear,
          'unitId': this.unitId,
          'theType': 1,
          'unitBeijing': 1
        }
        this.listLoading1 = true
        this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/queryList`, para).then(response => {
          this.listLoading1 = false
          if (response.data.success === true) {
            this.list1 = response.data.result
            if (selectedId) {
              this.toggleSelection(objName, selectedId)
            }
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          this.listLoading1 = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
      }
      if (!objName || objName === 'list2') {
        para = {
          'step': this.step,
          'theYear': this.theYear,
          'unitId': this.unitId,
          'theType': 1,
          'unitBeijing': 2
        }
        this.listLoading2 = true
        this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/queryList`, para).then(response => {
          this.listLoading2 = false
          if (response.data.success === true) {
            this.list2 = response.data.result
            if (selectedId) {
              this.toggleSelection(objName, selectedId)
            }
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          this.listLoading2 = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
      }
      if (!objName || objName === 'list3') {
        para = {
          'step': this.step,
          'theYear': this.theYear,
          'unitId': this.unitId,
          'theType': 2
        }
        this.listLoading3 = true
        this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/queryList`, para).then(response => {
          this.listLoading3 = false
          if (response.data.success === true) {
            this.list3 = response.data.result
            if (selectedId) {
              this.toggleSelection(objName, selectedId)
            }
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          this.listLoading3 = false
          console.log(error)
          this.$message({
            message: '获取失败:' + error,
            type: 'error'
          })
        })
      }
    },
    getStepBatch () {
      let para = {
        'pageNum': 1,
        'pageSize': 1,
        'step': this.step,
        'theYear': this.theYear,
        'unitId': this.unitId
      }
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPostStepBatch/queryByPage`, para).then(response => {
        console.log(response.data.success)
        if (response.data.success === true) {
          this.state = response.data.result.records[0] ? response.data.result.records[0].state : 0
          if (this.userType === 1 && (this.state === 0 || this.state === 5)) {
            this.canEdit = true
          } else {
            this.canEdit = false
          }
          if (this.userType === 2 && this.state === 1) {
            this.canBack = true
          } else {
            this.canBack = false
          }
          this.stepBatchId = response.data.result.records[0] ? response.data.result.records[0].id : null
          this.remarks = response.data.result.records[0] ? response.data.result.records[0].remarks : ''

          this.getPostList()
        } else {
          console.log('获取当前环节状态失败:' + response.data.message)
          this.$message({
            message: '获取当前环节状态失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '获取当前环节状态失败:' + error,
          type: 'error'
        })
      })
    },
    canSelect (row) {
      if (row.times) {
        return true
      } else {
        return false
      }
    },
    handleAdd (theType) {
      this.dialogTitle = '新增'
      this.addFormVisible = true
      this.editForm.id = null
      this.editForm.deduct = 0
      this.editForm.unitBeijing = (theType === 2 ? 2 : 1)
      this.editForm.theType = (theType === 3 ? 2 : 1)
      this.editForm.unitName = ''
      this.editForm.inBeijing = ''
      this.editForm.post = ''
      this.editForm.department = ''
      this.editForm.major = ''
      this.editForm.education = ''
      this.editForm.residenceRequirements = ''
      this.editForm.remark = ''
      this.editForm.others = ''
    },
    handleDetail (obj) {
      this.dialogTitle = '修改'
      this.editForm.id = obj.id
      this.editForm.deduct = obj.deduct
      this.editForm.unitBeijing = obj.unitBeijing
      this.editForm.theType = obj.theType
      this.editForm.unitName = obj.unitName
      this.editForm.inBeijing = obj.inBeijing
      this.editForm.department = obj.department
      this.editForm.post = obj.post
      this.editForm.major = obj.major
      this.editForm.education = obj.education
      this.editForm.residenceRequirements = obj.residenceRequirements
      this.editForm.remark = obj.remark
      this.editForm.others = obj.others
      this.addFormVisible = true
    },
    editFormSubmit () {
      this.$refs.editForm.validate((valid) => {
        if (valid) {
          let reg = /^[\u4e00-\u9fa5]+\([\da-zA-Z]+\)(;[\u4e00-\u9fa5]+\([\da-zA-Z]+\))*$/g
          this.editForm.major = this.editForm.major.toString().replace(/（/g, '(').replace(/）/g, ')').replace(/；/g, ';')
          if (!reg.test(this.editForm.major) || this.editForm.major.includes('00)')) {
            this.$message({
              message: '专业格式填写错误，请参照示例填写',
              type: 'error'
            })
            return false
          }
          this.editLoading = true
          let para = {
            id: this.editForm.id,
            theYear: this.theYear,
            theType: this.editForm.theType,
            unitBeijing: this.editForm.unitBeijing,
            unitName: this.editForm.unitName,
            inBeijing: this.editForm.inBeijing,
            post: this.editForm.post,
            department: this.editForm.department,
            major: this.editForm.major,
            deduct: this.editForm.deduct,
            education: this.editForm.education,
            residenceRequirements: this.editForm.residenceRequirements,
            remark: this.editForm.remark,
            others: this.editForm.others
          }
          this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/save`, para).then(response => {
            console.log(response.data.success)
            if (response.data.success === true) {
              this.$message({
                message: '保存成功',
                type: 'success'
              })
              this.addFormVisible = false
              this.editLoading = false
              this.getPostList()
            } else {
              console.log('保存失败:' + response.data.message)
              this.$message({
                message: '保存失败:' + response.data.message,
                type: 'error'
              })
              this.editLoading = false
            }
          }).catch(error => {
            console.log(error)
            this.$message({
              message: '保存失败:' + error,
              type: 'error'
            })
            this.editLoading = false
          })
        }
      })
    },
    export1 (theType) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusCandidateRegistration/export?unitBatchId=' + this.unitBatchId + '&type=' + theType)
    },
    export2 () {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusSettlementRegistration/export?unitBatchId=' + this.unitBatchId)
    },
    del (id) {
      // 未作table2处理
      let tableName = 'recruitBusCandidateRegistration'
      if (this.step === 'bus_settlement_registration') {
        tableName = 'recruitBusSettlementRegistration'
      }
      this.$confirm('确认删除该记录吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let para = {ids: [id]}
        this.listLoading = true
        this.$http.post(this.$http.defaults.recruitAPI + 'api/' + tableName + '/remove', para).then(response => {
          if (response.data.success === true) {
            this.addLoading = false
            this.$message({
              message: '删除成功',
              type: 'success'
            })
          } else {
            console.log('删除失败:' + response.data.message)
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
          this.getList()
        })
          .catch(error => {
            console.log(error)
            this.$message({
              message: '删除失败:' + error,
              type: 'error'
            })
          })
      })
    },
    getList () {
      // 未作table2处理
      let tableName = 'recruitBusSettlementRegistration'
      this.listLoading = true
      let para = {
        pageNum: 1,
        pageSize: 1000,
        unitBatchId: this.unitBatchId
      }
      if (this.step === 'bus_candidate_registration') {
        tableName = 'recruitBusCandidateRegistration'
        para.theType = 1
      }
      this.$http.post(this.$http.defaults.recruitAPI + 'api/' + tableName + '/queryByPage', para).then(response => {
        this.listLoading = false
        if (response.data.success === true) {
          this.list = response.data.result.records
        } else {
          console.log('获取数据失败:' + response.data.message)
          this.$message({
            message: '获取数据失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '网络获取失败:' + error,
          type: 'error'
        })
        this.listLoading = false
      })
      if (this.step === 'bus_candidate_registration') {
        let para2 = {
          pageNum: 1,
          pageSize: 1000,
          unitBatchId: this.unitBatchId,
          theType: 2
        }
        this.$http.post(this.$http.defaults.recruitAPI + 'api/' + tableName + '/queryByPage', para2).then(response => {
          this.listLoading = false
          if (response.data.success === true) {
            this.list_2 = response.data.result.records
          } else {
            console.log('获取数据失败:' + response.data.message)
            this.$message({
              message: '获取数据失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
          this.listLoading = false
        })
      }
    },
    showBack () {
      this.backFormVisible = true
      this.backForm.remark = ''
    },
    handleDel (id) {
      this.$confirm('确认删除该记录吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let para = {ids: [id]}
        this.listLoading = true
        this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/remove`, para).then(response => {
          if (response.data.success === true) {
            this.addLoading = false
            this.$message({
              message: '删除成功',
              type: 'success'
            })
          } else {
            console.log('删除失败:' + response.data.message)
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
          this.getPostList()
        })
          .catch(error => {
            this.addLoading = false
            console.log(error)
            this.$message({
              message: '删除失败:' + error,
              type: 'error'
            })
          })
      })
    },
    beforeUpload (file) {
      console.log('文件类型')
      console.log(file.name)
      const isFormat = file.name.indexOf('.docx') > 0 || file.name.indexOf('.doc') > 0 || file.name.indexOf('.pdf') > 0 || file.name.indexOf('.DOCX') > 0 || file.name.indexOf('.DOC') > 0 || file.name.indexOf('.PDF') > 0 || file.name.indexOf('.wps') > 0 || file.name.indexOf('.WPS') > 0
      const isLt500M = file.size / 1024 / 1024 < 60
      if (!isLt500M) {
        this.$message.error('单个附件不能超过60M!')
      } else {
        this.saveloading = true
      }
      if (!isFormat) {
        this.$message.error('附件格式必须为word、pdf、wps!')
      } else {
        this.saveloading = true
      }
      return isFormat && isLt500M
    },
    async handleUploadSucc1 (response, file, fileList) {
      this.uploadSuccCommon(response, file, fileList, this.step, 'files')
    },
    uploadSuccCommon (response) {
      if (response.success) {
        let para = {
          id: response.result[0].id,
          businessStep: this.step,
          theYear: this.theYear
        }
        this.$http.post(this.$http.defaults.recruitAPI + `api/recruitGenFileInfo/save`, para).then(res => {
          this.saveloading = false
          if (res.data.success === true) {
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
            this.getFileList()
          } else {
            console.log('上传失败:' + res.data.message)
            this.$message({
              message: '上传失败:' + res.data.message,
              type: 'error'
            })
          }
        })
          .catch(error => {
            this.saveloading = false
            console.log(error)
            this.$message({
              message: '上传失败:' + error,
              type: 'error'
            })
          })
      } else {
        this.saveloading = false
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    beforeRemove (file) {
      this.$confirm('确定删除' + file.fileName + '.' + file.fileType + '？', '提示', {
        type: 'warning'
      }).then(() => {
        this.handleRemove(file.id)
      })
    },
    handleRemove (id) {
      const url = 'api/recruitGenFileInfo/remove?id=' + id
      this.$http.get(this.$http.defaults.recruitAPI + url).then(res => {
        console.log('删除成功:', res)
        if (res.data.success === true) {
          this.getFileList()
          this.$message({
            message: '删除成功！',
            type: 'success'
          })
        }
      })
    },
    uploadError (err) {
      this.saveloading = false
      console.log(err)
      this.$message({
        message: '上传失败:' + err,
        type: 'error'
      })
    },
    download (id) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitGenFileInfo/download?id=' + id)
    },
    getFileList () {
      this.fileListLoading = true
      let para = {
        unitId: this.unitId,
        businessStep: this.step,
        theYear: this.theYear
      }
      let objName = 'files'
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitGenFileInfo/getFiles`, para).then(response => {
        this.fileListLoading = false
        if (response.data.success === true) {
          this[objName] = response.data.result
        } else {
          console.log('获取失败:' + response.data.message)
          this.$message({
            message: '获取失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '网络获取失败:' + error,
          type: 'error'
        })
        this.fileListLoading = false
      })
    },
    getNum (i) {
      return i < 10 ? '0' + i : i
    },
    setState (state) {
      this.$confirm('确认' + (state === 1 ? '提交' : '退回') + '吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let para = {
          id: this.state === 0 ? null : this.stepBatchId,
          state: state,
          theYear: this.theYear,
          step: this.step
        }
        if (state === 5) {
          para.remarks = this.backForm.remark
        }
        if (state === 1 && this.step !== 'bus_post_docking' && this.step !== 'bus_plan_release' && this.step !== 'bus_plan_declare') {
          if (this.multipleSelection && this.multipleSelection.length > 0) {
            para.postDockingIds = ',' + this.multipleSelection.join(',') + ','
          } else {
            this.$message({
              message: '请至少选择一个岗位',
              type: 'error'
            })
            return false
          }
        }
        if (this.step === 'bus_post_docking' && state === 1) {
          if (this.list1.filter(item => !item.deduct).length > 0 || this.list2.filter(item => !item.deduct).length > 0 || this.list3.filter(item => !item.deduct).length > 0) {
            this.$message({
              message: '操作失败：当前有岗位为未操作，不能提交',
              type: 'error'
            })
          } else {
            this.$http.get(this.$http.defaults.recruitAPI + `api/recruitBusPost/getDeductEquals?theYear=` + this.theYear).then(response => {
              if (response.data.success === true) {
                if (response.data.result) {
                  this.updatePostStepBatch(para)
                } else {
                  this.$message({
                    message: response.data.message,
                    type: 'error'
                  })
                }
              } else {
                console.log('操作失败:' + response.data.message)
                this.$message({
                  message: '操作失败:' + response.data.message,
                  type: 'error'
                })
              }
            }).catch(error => {
              console.log(error)
              this.$message({
                message: '操作失败:' + error,
                type: 'error'
              })
            })
          }
        } else {
          this.updatePostStepBatch(para)
        }
      })
    },
    updatePostStepBatch (para) {
      this.btnLoading = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPostStepBatch/save`, para).then(response => {
        this.btnLoading = false
        if (response.data.success === true) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.backFormVisible = false
          this.$emit('getDetails')
        } else {
          console.log('操作失败:' + response.data.message)
          this.$message({
            message: '操作失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        this.btnLoading = false
        console.log(error)
        this.$message({
          message: '操作失败:' + error,
          type: 'error'
        })
      })
    }
  }
}
</script>
<style scoped>
  .mytable{
    border-top: 1px solid #74a6cc;
    border-left: 1px solid #74a6cc;
    margin:0 10px 10px;
    width: calc(100% - 20px);
  }
  .mytable th{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    vertical-align: top;
    line-height: 150%;
    background: #FAFAFA;
    width:200px;
    text-align:right;
  }
  .mytable td{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    vertical-align: top;
    line-height: 150%;
  }
</style>
<style>
#recruitTable .el-table{
  border:1px solid #95B8E7 !important;
}
#recruitTable .el-table td, #recruitTable .el-table th{
  border-right:1px solid #95B8E7 !important;
  border-bottom:1px solid #95B8E7 !important;
}
</style>
